
import time

from selenium import webdriver
from selenium.webdriver.common import keys   #导入的是文件名 keys.py keys.Keys
from selenium.webdriver import ActionChains, Keys #导入的是类名
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait

#创建浏览器驱动对象
driver=webdriver.Edge()
driver.maximize_window()
driver.implicitly_wait(5)
#你要测试的网址
driver.get("http://127.0.0.1:8848/pagetest/rega.html")

ele2=driver.find_element(By.CSS_SELECTOR,"#selectA")
ActionChains(driver).click(ele2)
time.sleep(2)
action=ActionChains(driver)
el=WebDriverWait(driver,10).until(lambda x:x.find_element(By.CSS_SELECTOR,"option[value='gz']"))
# ele.click()
action.click(el)
action.perform()

# print(ele.get_attribute("value"))
#让我们的程序休眠
time.sleep(5) #针对是我们的程序，不是页面的元素
#浏览器驱动对象进行关闭
driver.quit()



